//router/index.js
//1.导入createRouter及createWebHistory
import {createRouter, createWebHistory} from 'vue-router'
import Home from "@/views/demo.vue"
import Demo from '@/views/demo.vue'
import Demo2 from '@/views/demo2.vue'
//2. 创建路由实例
const router = createRouter({    
    //2.1 路由模式    
    history: createWebHistory(import.meta.env.BASE_URL),    
    //2.2 路由配置规则    
    routes:[       
            {
                //路由地址
                path:'/',
                //名称
                name:'home',
                component:Demo
            },
            {
                path:'/demo',
                //名称
                name:'home',
                component:()=>import('@/views/demo.vue') 
            },
            {
                path:'/demo2',
                name:'demo2',
                component:Demo2
            }  
      ]})
    //3.将路由对象导出
    export default router